<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width"/>
    <title>knockout demo</title>
    <script type="text/javascript" src="../lib/knockoutjs/knockout-3.4.2.js"></script>
</head>
<body>
<!--单向绑定-->
<div>
    <p>First name: <strong data-bind="text: firstName"></strong></p>
    <p>Last name: <strong data-bind="text: lastName"></strong></p>
    <p>First name: <input data-bind="value: firstName"/></p>
    <p>Last name: <input data-bind="value: lastName"/></p>
</div>

<script type="text/javascript" src="../script/knockoutdata.js"></script>
<!--<script type="text/javascript">-->
<!--/**-->
<!--* Created by liqi on 2017/3/23.-->
<!--*/-->

<!--&lt;!&ndash;这段脚本实际项目中应该放在对应的JS文件中，然后在html中通过Script标签来引用即可&ndash;&gt;-->
<!--&lt;!&ndash;JS代码也就是业务逻辑部分，将业务逻辑与Html代码分割开，使得View代码更加简洁，这样后期也易于维护&ndash;&gt;-->
<!--function ViewModel() {-->
<!--this.firstName = ko.observable("kid");-->
<!--this.lastName = ko.observable("li");-->
<!--}-->

<!--ko.applyBindings(new ViewModel());-->
<!--</script>-->
</body>
</html>